import axios from 'axios'
import { Loading } from 'element-ui'
const request = axios.create({
  baseURL: 'http://timemeetyou.com:8889/api/private/v1/',
})

let loadingInstance = null
request.interceptors.request.use((config) => {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  loadingInstance = Loading.service({ fullscreen:true ,text:"请稍候",spinner:'el-icon-loading',background:"rgba(0, 0, 0, 0.8)"})
  return config
})

request.interceptors.response.use((response) => {
  loadingInstance.close()
  return response
})
export default request
